$('.home-slide').width(_rate*600).height(_rate*240).css({"margin-top":_rate*940});
$('.home-slide .swiper-slide, .home-slide .swiper-slide img').width(_rate*298).height(_rate*191);
$('.logo').width(_rate*262).height(_rate*81).css({"left":_rate*70});
$('.home-200').width(_rate*410).height(_rate*290).css({"top":_rate*538,"left":_rate*170});
$('.home-left, .home-right').width(_rate*50).height(_rate*52);
$('.home-left').css({"top":_rate*1022,"left":_rate*16});
$('.home-right').css({"top":_rate*1022,"right":_rate*16});

$('.home-2').height(_rate*80).css({"top":_rate*854});

$('.home-lj').width(_rate*174).height(_rate*49).css({"top":_rate*156,"left":_rate*68});
 

$('.juan-cha').width(_rate*250).height(_rate*144).css({"top":_rate*526,"left":_rate*250});
$('.juan-ling').width(_rate*310).height(_rate*100).css({"top":_rate*972,"left":_rate*220});
$('.juan-home').width(_rate*310).height(_rate*100).css({"top":_rate*1072,"left":_rate*220});
$('.xi-b1').width(_rate*304).height(_rate*56).css({"top":_rate*1006,"left":_rate*222});
$('.xi-b2').width(_rate*304).height(_rate*59).css({"top":_rate*1082,"left":_rate*222});

$('.tan-left, .tan-right').width(_rate*43).height(_rate*41);
$('.tan-left').css({"left":_rate*72});
$('.tan-right').css({"right":_rate*72});
$('.tan-close').width(_rate*42).height(_rate*43).css({"top":0,"left":_rate*630});
$('.tan-bclose').width(_rate*120).height(_rate*100).css({"top":-_rate*30,"left":_rate*596});
 

var _cha=(h-_rate*1045)/2;
$('.tan-slide').width(sWidth).height(_rate*1045).css({"margin-top":_cha});

if(_cha > 0){
 $('.home-2').css({"top":_rate*844 + _cha/7});
 $('.home-slide').height(_rate*270).css({"margin-top":_rate*940 + _cha/4});
} 

var _pSwip=new Swiper('.home-slide', {initialSlide:0,slidesPerView:2,loop:true,
		   pagination: {
                el: '.swiper-pagination',
              },
		   on: {
		   slideChangeTransitionStart: function(){
           $('.home-left, .home-right').hide();
           },
		   slideChangeTransitionEnd: function(){
		       $('.home-left, .home-right').fadeIn();
		    },},});
  
var _tSwip=new Swiper('.tan-slide', {initialSlide:0,loop : true,
	   on: {
	    slideChangeTransitionStart: function(){
           $('.tan-left, .tan-right').hide();
        },
	    slideChangeTransitionEnd: function(){
	        $('.tan-left, .tan-right').fadeIn();
	        if(3 != this.activeIndex){
	           //$('.tan-right').fadeIn();
	        }
	        if(0 != this.activeIndex){
	           //$('.tan-left').fadeIn();
	        }
	         
	    },},});

$('.home-200').click(function(){
   $(".home").fadeOut();
   $(".juan").fadeIn();
});  
$('.juan-home, .xi-b2').click(function(){
   $(".juan, .xi").fadeOut();
   $(".home").fadeIn();
});
$('.tan-bclose').click(function(){
   $(".t-bg, .tan").fadeOut();
    
});
$('.juan-cha').click(function(){
   $(".tan, .t-bg").fadeIn();
});
$('.home .swiper-slide').click(function(){
   var _id=$(this).attr("data-id");
   $(".xi .p-b").attr("src","./images/xi-t"+_id+'.png?v=8');
   $(".xi-qr").attr("src","./images/xi-"+_id+'.jpg?v=8');
   console.log(_id);
   $(".home").fadeOut();
   
   $(".xi").fadeIn();
});


$('.juan-ling').click(function(){
     $.post("./api/?c=shot2", {id:1}, function(data){
             if('go' == data.s){
            	 wx.addCard({
              	      cardList: [
              	        {
              	          cardId: data.c.cid,
              	          cardExt: '{"code": "'+data.c.code+'","openid": "<?php echo $openid; ?>", "timestamp": "'+data.c.timestamp+'", "signature":"'+data.c.sign+'"}'
              	        }
              	      ],
              	      success: function (res) {
              	         //alert(JSON.stringify(res))
              	         $.post("./api/?c=code1234", {code:res.cardList[0].code,thecode:data.c.code}, function(data){}, "json");
              	      },
              	      cancel: function (res) {
              	        //alert(JSON.stringify(res))
              	      }
              	    });
              }else{
                $(".weui-msg").html("您已领取过优惠券");
                $(".js_dialog").show();
                return;  
              
              }
          }, "json");
}); 

$(".js_dialog").click(function(){
        $(".js_dialog").hide();
	 }); 

